package com.example.boot01.controller;

import com.example.boot01.entity.Person;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

@Controller
public class ParamController {
    @RequestMapping("/p1")
    @ResponseBody
    public String param(HttpServletRequest request){
        String name = request.getParameter("name");
        String age = request.getParameter("age") ;
        return  "接收到了参数:"+name+","+age;
    }
    @RequestMapping("p2")
    @ResponseBody
    public String param(String name,Integer age){
        return "接收到了参数:"+name+","+age;
    }
    @RequestMapping("/p3")
    @ResponseBody
    public String param(Person person){
        return person.toString();
    }
}
